package com.ruoyi.web.controller.kiku;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.kiku.domain.KikuFilm;
import com.ruoyi.kiku.service.IKikuFilmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 小鞠影视信息Controller
 *
 * @author TT
 * @date 2025-03-13
 */
@RestController
@RequestMapping("/kiku/film")
public class KikuFilmController extends BaseController
{
    @Autowired
    private IKikuFilmService kikuFilmService;

    /**
     * 查询小鞠影视信息列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:film:list')")
    @GetMapping("/list")
    public TableDataInfo list(KikuFilm kikuFilm)
    {
        startPage();
        List<KikuFilm> list = kikuFilmService.selectKikuFilmList(kikuFilm);
        return getDataTable(list);
    }

    /**
     * 导出小鞠影视信息列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:film:export')")
    @Log(title = "小鞠影视信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, KikuFilm kikuFilm)
    {
        List<KikuFilm> list = kikuFilmService.selectKikuFilmList(kikuFilm);
        ExcelUtil<KikuFilm> util = new ExcelUtil<KikuFilm>(KikuFilm.class);
        util.exportExcel(response, list, "小鞠影视信息数据");
    }

    /**
     * 获取小鞠影视信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:film:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(kikuFilmService.selectKikuFilmById(id));
    }

    /**
     * 新增小鞠影视信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:film:add')")
    @Log(title = "小鞠影视信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody KikuFilm kikuFilm)
    {
        return toAjax(kikuFilmService.insertKikuFilm(kikuFilm));
    }

    /**
     * 修改小鞠影视信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:film:edit')")
    @Log(title = "小鞠影视信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody KikuFilm kikuFilm)
    {
        return toAjax(kikuFilmService.updateKikuFilm(kikuFilm));
    }

    /**
     * 删除小鞠影视信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:film:remove')")
    @Log(title = "小鞠影视信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(kikuFilmService.deleteKikuFilmByIds(ids));
    }
}
